package com.tommy.ddp
{
	import com.tommy.ddp.box.DdpBox;
	import com.tommy.ddp.grid.DdpGrid;
	
	import flash.geom.Rectangle;
	
	import starling.display.Sprite;
	
	public class DdpContainer extends Sprite
	{
		
		public function DdpContainer()
		{
			super();
			//this.clipRect = new Rectangle(0,0,100,100);
			createGrid();
		}
		
		private function createGrid():void
		{
			for(var i:uint = 0;i<9;i++)
			{
				for(var j:uint = 0;j<9;j++)
				{
					var grid:DdpGrid = new DdpGrid();
					grid.column = i;
					grid.row = j;
					addChild(grid);
					GridDataManager.regGrid(i,j,grid);
				}
			}
			createBox();
		}
		
		private function createBox():void
		{
			for(var i:uint = 0;i<9;i++)
			{
				for(var j:uint = 0;j<9;j++)
				{
					var box:DdpBox = new DdpBox();
					box.column = i;
					box.row = j;
					box.type = Math.floor(Math.random()*3);
					addChild(box);
					GridDataManager.regBox(i,j,box);
				}
			}
		}
	}
}